const now = new Date();
export function formatTime(){
  // 获取当前日期和时间

 
// 格式化输出年月日时分秒
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始，需要加1，并补零
const day = String(now.getDate()).padStart(2, '0');
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
 
const formattedTime = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
console.log(`当前日期和时间: ${formattedTime}`);
return formattedTime
}
//判断当前日期是星期几
export function getWeekDay(){


const weekdays = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];

const weekdayName = weekdays[now.getDay()];

console.log(`今天是: ${weekdayName}`);
return weekdayName
}
